const debug = import.meta.env.MODE !== 'production';

// 当前环境是否为安全环境
export const isSecureEnvironment = (() => {
  return (
    window.location.protocol === 'https:' ||
    window.location.hostname === 'localhost'
  );
})();

// 当前是否为单应用模式 PWA
export const isStandaloneMode = (() =>
  (window.matchMedia('(display-mode: standalone)').matches ||
    (window.navigator as any).standalone ||
    document.referrer.includes('android-app://')) === true)();

// 是否为 demo 环境
export const isDemoMode = (() => import.meta.env.VITE_DEMO_MODE === 'true')();

export default debug;
